<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="portal" uri="http://amc.af.mil/portal-el" %>
<%@ taglib prefix="rad" uri="http://amc.af.mil/radtaglibrary" %>
<%@ taglib prefix="display" uri="http://displaytag.sf.net" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="html" uri="http://struts.apache.org/tags-html-el" %>
<html>
<head>
    <title>Index of DRMO Packages</title>
</head>

<body>

<rad:useBean id="drmoPackageViewHelper"/>
<rad:useBean id="adpeAccountViewHelper"/>

<div id="portal-left-bar">
    <jsp:include page="../navigation/navigationMenu.jsp"/>
</div>

<div id="portal-content">
    <portal:box title="DRMO Packages for Account" style="width:800px">
        <portal:subSection title="Select Account">
            <p>
                <html:form action="/drmo/selectAccount.do" method="post">
                    <label for="organizationId">Account</label>
                    <c:choose>
                        <c:when test="${requestScope.accountId eq null}">
                            <html:select property="accountId" styleId="accountId"
                                         value="${sessionScope.accountId}">
                                <html:optionsCollection name="adpeAccountViewHelper"
                                                        property="adpeAccountsByAccount"
                                                        value="id"
                                                        label="name"/>
                            </html:select>
                            <html:submit value="Select Organization"/>
                        </c:when>
                        <c:otherwise>
                            <html:select property="accountId" styleId="accountId"
                                         value="${requestScope.accountId}">
                                <html:optionsCollection name="adpeAccountViewHelper"
                                                        property="adpeAccountsByAccount"
                                                        value="id"
                                                        label="name"/>
                            </html:select>
                            <html:submit value="Select Organization"/>
                        </c:otherwise>
                    </c:choose>

                </html:form>
            </p>
        </portal:subSection>
        <portal:subSection title="DRMO Packages">
            <display:table name="drmoPackageViewHelper.allByAdpeAccount"
                           id="pkg"
                           style="width:100%; text-align: center;">
                <display:column title="DTID">
                    <html:link href="drmo/viewPackage.do?packageId=${pkg.id}">
                        <c:out value="${pkg.dtid}"/>
                    </html:link>
                </display:column>
                <display:column title="Items">
                    <c:out value="${pkg.packageSize}"/>
                </display:column>
                <display:column title="Item Type">
                    <%--<c:out value="${pkg.packageType}"/>--%>
                </display:column>
                <display:column title="Item Condition">
                    &nbsp;
                </display:column>
                <display:column title="Status">
                    <c:choose>
                        <c:when test="${pkg.turninDate eq null}">
                            Pending
                        </c:when>
                        <c:otherwise>
                            Closed
                        </c:otherwise>
                    </c:choose>
                </display:column>
                <display:column title="Actions">
                    <c:choose>
                        <c:when test="${pkg.turninDate eq null}">
                            <html:link href="javascript:confirmCloseDrmoPackage(${pkg.id}, '${pkg.dtid}');">Close</html:link>
                            <html:link href="viewEditDrmoPackage.do?packageId=${pkg.id}">Edit</html:link>
                            <html:link href="javascript:confirmDeleteDrmoPackage(${pkg.id}, '${pkg.dtid}');">Delete</html:link>
                            <html:link href="javascript:create1348();">DD 1348-1</html:link>
                        </c:when>
                        <c:otherwise>
                            <html:link href="javascript:create1348();">DD 1348-1</html:link>
                        </c:otherwise>
                    </c:choose>
                </display:column>
            </display:table>
        </portal:subSection>
    </portal:box>
</div>

</body>
</html>